import {getUserById} from './sys/user/core';

module.exports = (r) => {
    r.get('/userInfo', ctx => {
        if (ctx.state && ctx.state.user) {
            return getUserById(ctx.state.user.id).then(ctx.done, ctx.fail);
        }
        return ctx.throw(401, '未授权');
    });
    r.post('/logout', ctx => {
        ctx.body = null;
    });
};
